package com.tvunetworks.center.user.mapper;


import com.tvunetworks.center.user.model.UserBookmark;
import com.tvunetworks.center.user.model.vo.UserBookmarkVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
/**
 * @program:
 * @description:
 * @author HenryChen
 * @create: 5/29/2019 12:17 PM
 **/
public interface UserBookmarkMapper extends Mapper<UserBookmark> {
    /**
     *
     * @param userId userId
     * @param parentId parentId
     * @return List
     */
    List<UserBookmarkVo> getAllChildBookmarkTree(@Param("userId") String userId, @Param("parentId") String parentId);

    /**
     *
     * @param userId userId
     * @param id id
     * @return List
     */
    List<UserBookmarkVo> getParentBookmarkTree(@Param("userId") String userId, @Param("id") String id);

    /**
     *
     * @param bookmarkIds bookmarkIds
     */
    void deleteBookmark(@Param("bookmarkIds") List<String> bookmarkIds);

    /**
     *
     * @param id id
     * @return UserBookmark
     * @throws Exception 编译异常
     */
    UserBookmark queryUserBookmarkById(@RequestParam("id") String id) throws Exception;

    /**
     *
     * @param userId userId
     * @return List
     */
    List<String> listUserBookmarkId(@Param("userId") String userId);

    /**
     //根据当前用户的父账号UserId查询,查询出被分享的bookMark；
     * @param userId userId
     * @param parentId parentId
     * @return List
     */
    List<UserBookmarkVo>   getShareBookmarkList(@Param("userId") String userId, @Param("parentId") String parentId) ;

    /**
     *
     * @param id id
     * @return String
     */
     String  selectParentId(String id);

    /**
     * 获取指定用户下存在peerId的bookmark
     * @param userId userId
     * @param peerId peerId
     * @return List
     */
    List<UserBookmark> listByUserIdAndPeerId(@Param("userId") String userId, @Param("peerId") String peerId);
}
